/**
 * RSGUIFACTORY.java
 * Created on April 12, 2007, 4:29 PM
 *
 *
 */

package edu.byu.isys413.jjenkins.data;

import edu.byu.isys413.jjenkins.view.*;
import java.util.Map;
import java.util.TreeMap;

/**
 * This class contains a tree map, which acts as a method to talkt to DAO and guis
 * @author Jeff Jenkins
 * @version 1.0
 */
public class RSGUIFACTORY {
    

    private static RSGUIFACTORY instance = null;
    Map factory; 
    
    /** Creates a new instance of RevenueSourceFactory*/
    private RSGUIFACTORY(){
        factory = new TreeMap();
        factory.put("backup", BackupGUI.getInstance());
        factory.put("service_repair", ServiceRepairGUI.getInstance());
        factory.put("batch", BatchGUI.getInstance());
        factory.put("rental", RentalGUI.getInstance());
//        factory.put("print_order", PrintOrderGUI.getInstance());
//        factory.put("conversion", ConversionGUI.getInstance());
        /*TODO add the other revenuesources */ 
    }
    

    
    /**
     * gets an instance of the revenuesource factory
     * @return 
     */
     public static synchronized RSGUIFACTORY getInstance() {
        if (instance == null) {
            instance = new RSGUIFACTORY();
        }
        return instance;
    }
    
    /**
     * This method returns the appropriate sub revenuesourceDAO based on the 
     * string that is passed in
     * 
     * @param name 
     * @return 
     */
     
    public javax.swing.JFrame getGUI(String name){
        
        return (javax.swing.JFrame)factory.get(name);
    }
    
}
